//src/main/java/com/cuit/blog/controller/ArticletypeService.java1
package com.cuit.blog.service;

import com.cuit.blog.dao.ArticletypeRespository;
import com.cuit.blog.entity.Articletype;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticletypeService {

    @Autowired
    ArticletypeRespository articletypeRespository;


    public Articletype findById(int id) {
        return articletypeRespository.findById(id).orElse(null);
    }

    public void save(Articletype articletype) {
        articletypeRespository.save(articletype);
    }
    public void deleteById(int id) {
        articletypeRespository.deleteById(id);
    }
    public List<Articletype> findAll() {
        return articletypeRespository.findAllByOrderByIdAsc();
    }

}
